﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CCPnuts.Pack;
using CCPnuts.IFileSplit.Interfaces;

namespace CCPnuts.IFileSplit
{
    public class Viewer : PackerBase
    {
        #region Packed Target

        internal Viewer(IPacked packed) : base(packed) { }

        internal new I_Viewer Packed { get { return (I_Viewer)base.Packed; } }

        #endregion

        #region Proxy Members

        #region Essential Memebers

        /// <summary>
        /// Gets the size of each split file.
        /// </summary>
        public int SplitSize
        {
            get
            {
                try
                {
                    return Packed.SplitSize;
                }
                catch (Exception ex)
                {
                    throw ex.Pack("Exception @ Viewer : SplitSize : Get");
                }
            }
        }

        /// <summary>
        /// Gets the count of part files.
        /// </summary>
        public int Count
        {
            get
            {
                try
                {
                    return Packed.Count;
                }
                catch (Exception ex)
                {
                    throw ex.Pack("Exception @ Viewer : Count : Get");
                }
            }
        }

        /// <summary>
        /// Gets a Array of the part files.
        /// </summary>
        public string[] PartFileNames
        {
            get
            {
                try
                {
                    return Packed.PartFileNames;
                }
                catch (Exception ex)
                {
                    throw ex.Pack("Exception @ Viewer : PartFileNames : Get");
                }
            }
        }

        /// <summary>
        /// Gets the name of the source File.
        /// </summary>
        public string FileName
        {
            get
            {
                try
                {
                    return Packed.FileName;
                }
                catch (Exception ex)
                {
                    throw ex.Pack("Exception @ Viewer : FileName : Get");
                }
            }
        }

        /// <summary>
        /// Gets the size of the source file.
        /// </summary>
        string FileSize
        {
            get
            {
                try
                {
                    return Packed.FileSize;
                }
                catch (Exception ex)
                {
                    throw ex.Pack("Exception @ Viewer : FileSize : Get");
                }
            }
        }

        #endregion

        #endregion
    }

    public static partial class PackedInfos
    {
        public static PackedInfo Viewer { get { return new PackedInfo(p => new Viewer(p)); } }
    }
}
